package com.bbm.communitysystem.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.bbm.communitysystem.domain.Family;
import com.bbm.communitysystem.domain.dto.FamilyDto;
import com.bbm.communitysystem.mapper.FamilyMapper;
import com.bbm.communitysystem.service.IFamilyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author bbm
 * @since 2025-02-21
 */
@Service
public class FamilyServiceImpl extends ServiceImpl<FamilyMapper, Family> implements IFamilyService {

    @Override
    public FamilyDto createFamily(FamilyDto familyDto) {
        Family family = new Family();

        family.setFamilyName(familyDto.getFamilyName());
        family.setUpdateBy(familyDto.getUpdateBy());
        family.setUpdateTime(System.currentTimeMillis() + "");
        boolean save = save(family);



        return save ? BeanUtil.copyProperties(family, FamilyDto.class) : null;
    }
}
